﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 考试管理系统;

namespace WindowsFormsApp1
{

    public partial class FmHome : Form
    {
        public string UseName;
        public FmHome()
        {
            InitializeComponent();
          
        }
        //退出
        private void button8_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }


        #region 切换页面
        private void button6_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            Cws(button.Text.Trim());
        }
        void Cws(string str)
        {
            Form form = null;
            switch (str)
            {
                case "首页": panel3.Controls.Clear() ; return ;
                case "学生管理": form = new FrStudentManage(); ; break;
                case "考试管理": form = new FrExamManage(); ; break;
                case "添加考试": form = new FrAddExam(); ; break;
                case "成绩查询": form = new FrScoreAdd(); ; break;
                case "题库管理": form = new FrQuestionBankManage() ; break;
                default: return;
            }

            if (panel3.Controls.Count > 0 && panel3.Controls[0].Name == form.Name)
            {
                return;
            }
            // form.BackColor = System.Drawing.Color.Transparent;
            form.TopLevel = false;
            form.Parent = panel3;
            //form.BringToFront();
            form.Show();
            if (panel3.Controls.Count > 1)
            {
                panel3.Controls.RemoveAt(0);
            }
        }
        #endregion
        #region 加载用户名
        private void FmHome_Paint(object sender, PaintEventArgs e)
        {
            label2.Text = UseName;
        }
        #endregion
        #region  用户设置

        private void pictureBox1_MouseEnter(object sender, EventArgs e)
        {
            panel4.Visible = true;
        }   

        private void panel1_MouseEnter(object sender, EventArgs e)
        {
            panel4.Visible = false;
        }
        //修改密码
        private void uiButton4_Click(object sender, EventArgs e)
        {
            FmChangePassword form3 = new FmChangePassword();
            form3.ShowDialog();
        }
        //切换账号
        private void uiButton3_Click(object sender, EventArgs e)
        {
            FrmLogin frmLogin=new FrmLogin();
            frmLogin.s1 = true;
            frmLogin.ShowDialog();
        }
        //个人设置
        //退出登录
        #endregion


    }
}
